<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        echo "今天是 " . date("Y/m/d") . "<br>";
        date_default_timezone_set("Asia/Shanghai");"<br>";
        echo "当前时间是 " . date("h:i:sa")."<br>";
        
       function diffBetweenTwoDays ($day1, $day2)
{
  $second1 = strtotime($day1);
  $second2 = strtotime($day2);
    
  if ($second1 < $second2) {
    $tmp = $second2;
    $second2 = $second1;
    $second1 = $tmp;
  }
  return ($second1 - $second2) / 86400;
}
$day1 = "2016-09-18";
$day2 = "2016-10-01";
$diff = diffBetweenTwoDays($day1, $day2);
echo "距离国庆节还有：",$diff."\n","天";
        ?>
    </body>
</html>
